$OpenBSD: patch-cmake_modules_KAppTemplateMacro_cmake,v 1.3 2014/07/09 20:03:24 zhuk Exp $
Make usage of archivators more visible and predictable.
--- cmake/modules/KAppTemplateMacro.cmake.orig	Mon Mar 24 08:35:11 2014
+++ cmake/modules/KAppTemplateMacro.cmake	Fri Jun 27 14:01:51 2014
@@ -1,3 +1,22 @@
+find_program(_kapptemplate_prog_gnu_tar NAMES gtar tar)
+find_program(_kapptemplate_prog_zip NAMES 7za)
+
+if (_kapptemplate_prog_gnu_tar)
+    message(STATUS "Found GNU tar program: ${_kapptemplate_prog_gnu_tar}")
+elseif (NOT WIN32)
+    message(SEND_ERROR "Could not find GNU tar program")
+else ()
+    message(STATUS "Could not find GNU tar program")
+endif ()
+
+if (_kapptemplate_prog_zip)
+    message(STATUS "Found zip program: ${_kapptemplate_prog_zip}")
+elseif (WIN32)
+    message(SEND_ERROR "Could not find zip program")
+else ()
+    message(STATUS "Could not find zip program")
+endif ()
+
 macro(kapptemplate_add_app_templates _templateNames)
     foreach(_templateName ${ARGV})
 
@@ -30,12 +49,12 @@ macro(kapptemplate_add_app_templates _templateNames)
 
         if(WIN32)
             add_custom_command(OUTPUT ${_template}
-                COMMAND 7za ARGS a -r -tzip ${_template} ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}/*
+                COMMAND ${_kapptemplate_prog_zip} ARGS a -r -tzip ${_template} ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}/*
                 DEPENDS ${_deps}
             )
         else(WIN32)
             add_custom_command(OUTPUT ${_template}
-                COMMAND tar ARGS -c -C ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}
+                COMMAND ${_kapptemplate_prog_gnu_tar} ARGS -c -C ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}
                     --exclude .kdev_ignore --exclude .svn
                     -j -f ${_template} .
                 DEPENDS ${_deps}
